#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+10;
int n,cnt,l,ans,b[maxn],ton[maxn],nxt[maxn];
struct node{
    int d,id,nd;
}a[maxn];
int cmp(node p,node q){
    return p.d<q.d;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    ans=n;
    for(int i=1;i<=n;i++){
        cin>>a[i].d;
        a[i].id=i;
    }
    sort(a+1,a+n+1,cmp);
    a[1].nd=1;
    for(int i=2;i<=n;i++){
        if(a[i].d>a[i-1].d){
            a[i].nd=a[i-1].nd+1;
            nxt[a[i-1].nd]=a[i].nd;
        }
        else a[i].nd=a[i-1].nd;
    }
    for(int i=1;i<=n;i++){
        ton[a[i].nd]++;
    }
    for(int i=1;i<=n;i++)b[i]=a[i].nd;
    /*
    for(int i=1;i<=n-1;i++){
        if(ton[nxt[a[i].nd]]){
            cout<<i<<" "<<nxt[a[i].nd]<<endl;
            ans--;
            ton[nxt[a[i].nd]]--;
            if(ton[nxt[a[i].nd]]==0){
                nxt[a[i].nd]=nxt[nxt[a[i].nd]];
                if(i==1)cout<<"*"<<nxt[a[i].nd]<<endl;
            }
        }
    }
    */
    l=2;
    for(int i=1;i<=n-1;i++){
        int x=upper_bound(b+l,b+n+1,a[i].nd)-b;
        //cout<<x<<endl;
        if(x>n||x<=i)continue;
        ans--;
        l=x+1;
    }
    cout<<ans;
    return 0;
}

/*
6
1 1 2 3 4 4
*/
